home *** CD-ROM | disk | FTP | other *** search
AMOS Source Code | 1980-05-17 | 1.1 KB | 24 lines |
- '********************WEND WILL I SEE YOU AGAIN?-By Mark Wickson*******************
- Rem As with other loops,the "While...Wend" structure can be used to perform
- Rem tasks repeatedly,but the special thing about these commands is that you
- Rem can exit from the loop if a certain condition is achieved.
- Rem First you write:
- Rem While
- Rem and then you write the condition for the loop to continue-So you might
- Rem want it to continue if a variable is less than a certain number-In this
- Rem example we use the variable "X"-Making the loop continue until "X"
- Rem equals 100,like this:
- Rem While X<=100
- Rem after this you write the various commands inside the loop,in this example,
- Rem we print the current value of "X",add 1 to the "X" variable,and wait point
- Rem five of a second before beoing sent back to "While" with "Wend"-"While"
- Rem then checks to see if the certain condition is still in operation-
- Rem In this case if "X" is equal to or less than 100 the loop continues.
- Rem When the conditions change(here,it would mean X=100) the loop is ended and
- Rem the program continues.
- X=0
- While X<=100
- Print At(0,0);X
- X=X+1
- Wait 5
- Wend